package com.megvii.corelib.util;

import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;

/**
 * Created by linyue on 16/3/3.
 */
public class ClipboardUtil
{
    public static void copyPlainText(Context context, String text)
    {
        ClipboardManager manager = getManager(context);
        ClipData clip;
        clip = ClipData.newPlainText("text", text);
        manager.setPrimaryClip(clip);
    }

    private static ClipboardManager getManager(Context context)
    {
        return (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
    }
}
